package com.jiuyou.clientController.visitRecord;

import com.jiuyou.clientController.base.ClientBaseController;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.visitRecord.domain.VisitRecord;
import com.ruoyi.visitRecord.service.IVisitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @Author: chengliang
 * @Date: Created in 2022/2/8
 */
@RestController
@RequestMapping("/client/visitRecord")
public class VisitRecordClientController extends ClientBaseController {
    @Autowired
    private IVisitRecordService service;
    @PostMapping("/{id}")
    public void insr(@PathVariable Long id){
        VisitRecord visitRecord = new VisitRecord();
        visitRecord.setMemberId(getLoginMemberId());
        visitRecord.setStoreId(id);
        String time = DateUtils.getSplit();
        String[] date = time.split("_");
        visitRecord.setTimeY(date[0]);
        visitRecord.setTimeMo((date[1]));
        visitRecord.setTimeD(date[2]);
        visitRecord.setTimeH(date[3]);
        visitRecord.setTimeM(date[4]);
        service.insertVisitRecord(visitRecord);
    }
}
